
import worker from '@ohos.worker'
//主线程中创建worker对象
const  workerInstance = new worker.ThreadWorker("entry/ets/pages/workers/worker.ts")

//主线程接收worker线程消息
workerInstance.onmessage = function (e){
  let data= e.data
  console.log("peiqi:"+data)
}
workerInstance.onexit = function(){
  console.log("mainjs")
}
function test(){
  workerInstance.postMessage({ key:"12312" })
}
export {test}
